﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Media;

namespace PdxDemo.IDataErrorInfoDemo
{
    public class ViewModel : ViewmodelBase
    {
        // This tells the DefaultPropertyResolver to look here for properties.
        // So if "FirstName" isn't found on this (the CustomerViewModel), the
        // resolver will try to find it on the DataModel.
        [PDX.PropertySource]
        public CustomerPOCO DataModel { get; private set; }
        
        public ViewModel()
        {
            DataModel = new CustomerPOCO();
        }

        public string FullName
        {
            get
            {
                return String.Format("{0}, {1}", DataModel.LastName, DataModel.FirstName);
            }
        }

        Color theColor = Colors.Goldenrod;
        public Color TheColor
        {
            get
            {
                return theColor;
            }
            set
            {
                theColor = value;
                OnPropertyChanged("TheColor");
            }
        }
    }
}
